package com.achievo.know.web.system;

import org.springframework.beans.factory.annotation.Autowired;

import com.achievo.know.application.SystemConfigApplication;
import com.achievo.know.domain.SystemConfig;
import com.achievo.know.web.util.PageActionSupport;
import com.redhat.redwork.coc.RedworkAction;

public class SystemAction extends PageActionSupport implements RedworkAction{
	
	public String home(){
		config=systemConfigApplication.getConfig();
		return "home";
	}
	
	public String admin(){
		return "admin";
	}
	
	public String save(){
		SystemConfig temp=systemConfigApplication.getConfig();
		temp.setHeadTitle(config.getHeadTitle());
		temp.setTitle(config.getTitle());
		temp.setFileSize(config.getFileSize());
		systemConfigApplication.save(temp);
		config=systemConfigApplication.getConfig();
		return "home";
	}

	/**
	 * 
	 */
	private static final long serialVersionUID = 426177647374772815L;
	
	@Autowired
	private SystemConfigApplication systemConfigApplication;

	public void setSystemConfigApplication(
			SystemConfigApplication systemConfigApplication) {
		this.systemConfigApplication = systemConfigApplication;
	}
	
	private SystemConfig config;

	public SystemConfig getConfig() {
		return config;
	}

	public void setConfig(SystemConfig config) {
		this.config = config;
	}
	
	

}
